home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2003 May / cmycha200305.iso / MutantStorm / setup_mutantstorm_demo.exe / {app} / script / floor_chooser.lua < prev    next >
Text File  |  2003-03-11  |  5KB  |  156 lines

  1.  
  2. function floor_start( floorname, count, delay )
  3.  
  4.     floorname = format ( "floor-%s", floorname )
  5.  
  6.     local actor = ACTOR_preload()
  7.  
  8.     actor[cp_actor_name]        = floorname
  9.     actor[cp_model_dir]            = "rooms"
  10.     actor[cp_model_name]        = floorname
  11.  
  12.     actor[cp_actor_type]            = cat_ground
  13.     actor[cp_i_collide_with_beasties]    = 0
  14.     actor[cp_these_collide_with_me]        = 0
  15.  
  16.     actor[cp_launch_hue_shift] = floor_hue[1]
  17.  
  18. -- change texture ?
  19. if floor_bmpswap ~= nil then
  20.     for t = 1,19,2 do
  21.         if floor_bmpswap[t] ~= nil then
  22.             c_change_bitmap( floor_bmpswap[t], floor_bmpswap[t+1] )
  23.         else
  24.             -- end loop
  25.             break
  26.         end
  27.     end
  28. end
  29.  
  30.     c_preload_model( actor )
  31.  
  32.  
  33.     c_set_random_anim( floor_keyset1[1], floor_keyset1[2], floor_keyset1[3], floor_keyset1[4], floor_keyset1[5] )
  34.  
  35.     if floor_keyset2 ~= nil then
  36.         c_set_random_anim( floor_keyset2[1], floor_keyset2[2], floor_keyset2[3], floor_keyset2[4], floor_keyset2[5] )
  37.     end
  38.  
  39.  
  40.     local apo = ACTOR_PreLaunch( floorname )
  41.  
  42.     local size = floor_pos[5]
  43.     local posx = 0
  44.     local posy = 0
  45.     local posz = 0
  46.     local rot = 0
  47.     local hue = 0
  48.  
  49.     for t = 0, ( count -  1 ), 1 do
  50.         posx = floor_pos[1] + (floor_trans[1] * t)
  51.         posy = floor_pos[2] + (floor_trans[2] * t)
  52.         posz = floor_pos[3] + (floor_trans[3] * t)
  53.         rot = floor_pos[4] + (floor_trans[4] * t)
  54.         hue = floor_hue[2] * t
  55.         apo:setall( posx, posy, posz, rot, size, hue, 0.0 )
  56.         apo:setanimdelay( delay * t )
  57.         apo:launch()
  58.         size = size * floor_trans[5]
  59.     end
  60. end
  61.  
  62.  
  63. function floor_start_random()
  64.     if gfx_level < 1 then
  65.         return
  66.     end
  67.  
  68.     local choice_floortype_name = { "1", "1", "1","1", "1", "1","1", "1", "1", "2" }
  69.     local choice_floortype_num = c_zrand_int( 10 ) + 1
  70.  
  71.     local choice_keyset1_name = { "pulse", "swiv20", "scale20", "scale5" }
  72.     local choice_keyset1_num = c_zrand_int( 4 ) + 1
  73.     local choice_keyset1_speed_min = c_zrand( 200 ) + 100
  74.     local choice_keyset1_speed_max = choice_keyset1_speed_min -- c_zrand( 200 ) + 100
  75.  
  76.     floor_keyset1 = { choice_keyset1_name[choice_keyset1_num], choice_keyset1_speed_min, choice_keyset1_speed_max, 0, 0 }
  77.  
  78.  
  79.     floor_keyset2 = nil
  80.     if choice_floortype_name[choice_floortype_num] == "1" then
  81.         local choice_keyset2_name = { "flat", "scale170", "scale140", "scale120", "scale80", "scale60", "scale30", "ysquish", "xsquish", "flat","flat","flat","flat","flat","flat","tilth","tiltv","movev","moveh","anitwist30", "anisquish-1", "anisquish-2" }
  82.         local choice_keyset2_num = c_zrand_int( 22 ) + 1
  83.         local choice_keyset2_speed_min = c_zrand( 200 ) + 100
  84.         local choice_keyset2_speed_max = choice_keyset2_speed_min -- c_zrand( 200 ) + 100
  85.  
  86.         local ani_delay = 0
  87.         if choice_keyset2_num < 16 then
  88.             ani_delay = 600
  89.         end
  90.  
  91.         floor_keyset2 = { choice_keyset2_name[choice_keyset2_num], choice_keyset2_speed_min, choice_keyset2_speed_max, ani_delay, ani_delay }
  92.     end
  93.  
  94.  
  95.     local floor_posy = 20.0
  96.     floor_pos = { 0,-floor_posy,0, 0,200 }
  97.  
  98.     local choice_floortype_count = c_zrand_int( 3 ) + 3
  99.     local choice_floortype_delay = c_zrand( 0.2 ) + 0.2
  100.     floor_posy = c_zrand( 20.0 ) + 20.0
  101.     floor_trans = { 0,-floor_posy,0, 0,c_zrand(0.85,1.0) }
  102.  
  103.     local floor_hue_add = c_zrand(-45.0,45.0)
  104.     if floor_hue_add > 0.0 then
  105.         floor_hue_add = floor_hue_add + 15.0
  106.     else
  107.         floor_hue_add = floor_hue_add - 15.0
  108.     end
  109. --    c_print( "hue", gfx_level, floor_hue_add )
  110.  
  111.     if gfx_level == 3 then
  112.         choice_floortype_count = c_zrand_int( 6 ) + 6
  113.         choice_floortype_delay = c_zrand( 0.1 ) + 0.1
  114.         floor_trans[2] = floor_trans[2] * 0.5
  115.         floor_trans[5] = c_zrand(0.9,1.0)
  116.     elseif gfx_level == 1 then
  117.         choice_floortype_count = c_zrand_int( 2 ) + 2
  118.         choice_floortype_delay = c_zrand( 0.3 ) + 0.3
  119.         floor_trans[2] = floor_trans[2] * 2.0
  120.         floor_trans[5] = c_zrand(0.8,1.0)
  121.     end
  122.  
  123.     local choice_bitmap = 0
  124.     local bitmap_name = ""
  125.     floor_bmpswap = nil
  126.  
  127.     if choice_floortype_name[choice_floortype_num] == "2" then
  128. --        choice_bitmap = c_zrand_int( 2 ) + 1
  129. --        bitmap_name = "tunnel-1tile"
  130.         choice_floortype_count = c_zrand_int( 3 ) + 6
  131.         if gfx_level == 1 then
  132.             choice_floortype_count = c_zrand_int( 3 ) + 3
  133.         end
  134.         floor_trans[2] = -( c_zrand( 20.0 ) + 20.0 )
  135.         floor_trans[5] = c_zrand(0.7,0.9)
  136.         floor_hue_add = floor_hue_add * 2.0
  137.     elseif choice_floortype_name[choice_floortype_num] == "1" then
  138.         choice_bitmap = c_zrand_int( 18 ) + 1
  139.         if demo_level == 1 then
  140.             choice_bitmap = c_zrand_int( 4 ) + 1
  141.         end
  142.         bitmap_name = "floor-1_"
  143.     end
  144.  
  145.     if choice_bitmap > 1 then
  146.         local bitmap_name_1 = format( "%s%d.bmp", bitmap_name, 1 )
  147.         local bitmap_name_2 = format( "%s%d.bmp", bitmap_name, choice_bitmap )
  148.         floor_bmpswap = { bitmap_name_1 , bitmap_name_2 }
  149.     end
  150.  
  151.     floor_hue_add = (floor_hue_add / choice_floortype_count)
  152.     floor_hue = { floor_colour, floor_hue_add }
  153.  
  154.     floor_start( choice_floortype_name[choice_floortype_num], choice_floortype_count, choice_floortype_delay )
  155. end
  156.